\(\int \cos (a+b x) \cot ^2(a+b x) \, dx\) [137]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 23 \[ \int \cos (a+b x) \cot ^2(a+b x) \, dx=-\frac {\csc (a+b x)}{b}-\frac {\sin (a+b x)}{b} \]

[Out]

-csc(b*x+a)/b-sin(b*x+a)/b

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {2670, 14} \[ \int \cos (a+b x) \cot ^2(a+b x) \, dx=-\frac {\sin (a+b x)}{b}-\frac {\csc (a+b x)}{b} \]

[In]

Int[Cos[a + b*x]*Cot[a + b*x]^2,x]

[Out]

-(Csc[a + b*x]/b) - Sin[a + b*x]/b

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 2670

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-f^(-1), Subst[Int[(1 - x^2
)^((m + n - 1)/2)/x^n, x], x, Cos[e + f*x]], x] /; FreeQ[{e, f}, x] && IntegersQ[m, n, (m + n - 1)/2]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {1-x^2}{x^2} \, dx,x,-\sin (a+b x)\right )}{b} \\ & = -\frac {\text {Subst}\left (\int \left (-1+\frac {1}{x^2}\right ) \, dx,x,-\sin (a+b x)\right )}{b} \\ & = -\frac {\csc (a+b x)}{b}-\frac {\sin (a+b x)}{b} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.00 \[ \int \cos (a+b x) \cot ^2(a+b x) \, dx=-\frac {\csc (a+b x)}{b}-\frac {\sin (a+b x)}{b} \]

[In]

Integrate[Cos[a + b*x]*Cot[a + b*x]^2,x]

[Out]

-(Csc[a + b*x]/b) - Sin[a + b*x]/b

Maple [A] (verified)

Time = 0.17 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.52

method result size
parallelrisch \(\frac {\left (-3+\cos \left (2 b x +2 a \right )\right ) \sec \left (\frac {b x}{2}+\frac {a}{2}\right ) \csc \left (\frac {b x}{2}+\frac {a}{2}\right )}{4 b}\) \(35\)
derivativedivides \(\frac {-\frac {\cos ^{4}\left (b x +a \right )}{\sin \left (b x +a \right )}-\left (2+\cos ^{2}\left (b x +a \right )\right ) \sin \left (b x +a \right )}{b}\) \(42\)
default \(\frac {-\frac {\cos ^{4}\left (b x +a \right )}{\sin \left (b x +a \right )}-\left (2+\cos ^{2}\left (b x +a \right )\right ) \sin \left (b x +a \right )}{b}\) \(42\)
risch \(\frac {i \left ({\mathrm e}^{3 i \left (b x +a \right )}-5 \cos \left (b x +a \right )-7 i \sin \left (b x +a \right )\right )}{2 b \left ({\mathrm e}^{2 i \left (b x +a \right )}-1\right )}\) \(47\)
norman \(\frac {-\frac {1}{2 b}-\frac {3 \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{b}-\frac {\tan ^{4}\left (\frac {b x}{2}+\frac {a}{2}\right )}{2 b}}{\tan \left (\frac {b x}{2}+\frac {a}{2}\right ) \left (1+\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}\) \(66\)

[In]

int(cos(b*x+a)^3/sin(b*x+a)^2,x,method=_RETURNVERBOSE)

[Out]

1/4/b*(-3+cos(2*b*x+2*a))*sec(1/2*b*x+1/2*a)*csc(1/2*b*x+1/2*a)

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 22, normalized size of antiderivative = 0.96 \[ \int \cos (a+b x) \cot ^2(a+b x) \, dx=\frac {\cos \left (b x + a\right )^{2} - 2}{b \sin \left (b x + a\right )} \]

[In]

integrate(cos(b*x+a)^3/sin(b*x+a)^2,x, algorithm="fricas")

[Out]

(cos(b*x + a)^2 - 2)/(b*sin(b*x + a))

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 39 vs. \(2 (17) = 34\).

Time = 0.36 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.70 \[ \int \cos (a+b x) \cot ^2(a+b x) \, dx=\begin {cases} - \frac {2 \sin {\left (a + b x \right )}}{b} - \frac {\cos ^{2}{\left (a + b x \right )}}{b \sin {\left (a + b x \right )}} & \text {for}\: b \neq 0 \\\frac {x \cos ^{3}{\left (a \right )}}{\sin ^{2}{\left (a \right )}} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(b*x+a)**3/sin(b*x+a)**2,x)

[Out]

Piecewise((-2*sin(a + b*x)/b - cos(a + b*x)**2/(b*sin(a + b*x)), Ne(b, 0)), (x*cos(a)**3/sin(a)**2, True))

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.87 \[ \int \cos (a+b x) \cot ^2(a+b x) \, dx=-\frac {\frac {1}{\sin \left (b x + a\right )} + \sin \left (b x + a\right )}{b} \]

[In]

integrate(cos(b*x+a)^3/sin(b*x+a)^2,x, algorithm="maxima")

[Out]

-(1/sin(b*x + a) + sin(b*x + a))/b

Giac [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.87 \[ \int \cos (a+b x) \cot ^2(a+b x) \, dx=-\frac {\frac {1}{\sin \left (b x + a\right )} + \sin \left (b x + a\right )}{b} \]

[In]

integrate(cos(b*x+a)^3/sin(b*x+a)^2,x, algorithm="giac")

[Out]

-(1/sin(b*x + a) + sin(b*x + a))/b

Mupad [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.00 \[ \int \cos (a+b x) \cot ^2(a+b x) \, dx=-\frac {{\sin \left (a+b\,x\right )}^2+1}{b\,\sin \left (a+b\,x\right )} \]

[In]

int(cos(a + b*x)^3/sin(a + b*x)^2,x)

[Out]

-(sin(a + b*x)^2 + 1)/(b*sin(a + b*x))